﻿#include "EditorTestButtonStatusViewModel.h"
#include "StatusBar/TestButton/EditorTestButtonStatusModel.h"
#include "Output/Console.h"


#include "Notification/Notification.h"

#include "Window/EditorWindowGroupModel.h"

#include "Widgets/EditorProgressBarModalWindow.h"
#include "Widgets/Window.h"

void REditorTestButtonStatusViewModel::BindModel(TSharedObjectPtr<REditorStatusItemModel> InModel)
{
    Super::BindModel(InModel);
    TestButtonModel=InModel;
}

void REditorTestButtonStatusViewModel::Test()
{
    //在此写一些测试代码

    static int ClickCount=0;
    ClickCount++;
    WH::PrintLine(U"第{}次点击了测试按钮",ClickCount);

    //测试通知
    //WHE::AddWanringNotification(U"这是一条测试警告消息"+CString(ClickCount));
 
    //测试子窗口
    //REditorWindowGroupModel::Get()->CreateSubwindow();
    
    //测试进度条窗口
    static TSharedObjectPtr<RWindow> ProgressBarWindow;
    if(!ProgressBarWindow)
    {
        WHE::SProgressBarModalWindowCreateParameter
            Parameter;

        Parameter.Percentage=0.5f;
        Parameter.PercentageText=U"正在下载文件... 50%";
        Parameter.OnCanceled.BindLambda([]()
        {
            WHE::CloseProgressBarModalWindow(ProgressBarWindow);
            ProgressBarWindow=nullptr;
        });

        WHE::ShowProgressBarModalWindow(
            Parameter
            ,ProgressBarWindow);
    }


}
